package cn.tedu.eguser.base.exception;

import cn.tedu.eguser.base.response.JsonResult;
import cn.tedu.eguser.base.response.StatusCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {



    @ExceptionHandler(MethodArgumentNotValidException.class)
    public JsonResult doHandleMethodArgumentNotValidException(MethodArgumentNotValidException ex) {
        String data = ex.getMessage();
        log.debug("开始处理异常：{}", ex.getMessage());
        return new JsonResult(StatusCode.OPERATION_FAILED,data);
    }






















}
